home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagg_m.zip / MATH.SWG / 0001_3DPOINTS.PAS.pas next >
Pascal/Delphi Source File  |  1993-05-28  |  745b  |  28 lines

  1. {
  2. > Could someone please explain how to plot a 3-D points? How do you convert
  3. > a 3D XYZ value, to an XY value that can be plotted onto the screen?
  4. }
  5.  
  6. Function x3d(x1, z1 : Integer) : Integer;
  7. begin
  8.   x3d := Round(x1 - (z1 * Cos(Theta)));
  9. end;
  10.  
  11. Function y3d(y1, z1 : Integer) : Integer;
  12. begin
  13.   y3d := Round(y1 - (z1 * Sin(Theta)));
  14. end;
  15.  
  16. {
  17. So a Function that plots a 3d pixel might look like this:
  18.  
  19. Procedure plot3d(x, y, z : Integer);
  20. begin
  21.   plot(x3d(x, z), y3d(y, z));
  22. end;
  23.  
  24. The theta above is the angle on the screen on which your are "simulating"
  25. your z axis.  This is simplistic, but should get you started.  Just remember
  26. you are simulating 3 dimensions on a 2 dimension media (the screen).  Trig
  27. helps. ;-)
  28. }